import Vue from 'vue'
import Vuex from 'vuex'

import storeModules from'./storeMap.js'

Vue.use(Vuex)

const store = new Vuex.Store({
  modules: {
    ...storeModules,
  },
  getters:{
  	unreadCount(state,getters){
  		const addrCount = getters['addr/apprCount']||0
  		const chatCount = getters['chat/unread']||0
  		const count = addrCount+chatCount
  		// #ifdef APP-PLUS
  		plus.runtime.setBadgeNumber(count)
  		// #endif
  		return count
  	}
  }
})
export default store;
